﻿using System;

using enyo;

namespace com.RexToy
{
    public class TempView : ConverterView
    {
        private object[] components = new object[]{ 
            new {kind= ControlKind.BasicScroller, 
                components=new object[] {
                    new {kind=ControlKind.RowGroup, 
                        components= new object[]{
				            new {name= "c", richContent= false, kind = ControlKind.Input, onblur="blur",
                                    components=new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Celsius")}
                                    }
                            },
                            new {name= "f", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components= new object[]{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Fahrenheit")}
				                    }
                            },
				            new {name= "k", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.g11nGlobal._L("Kelvin")}
				                   }
				            }
			            }                    
		            }      
                }
            }
        };

        public override void Create()
        {
            this.Inherited(Arguments.Value);

            this.units = new string[] { "c", "f", "k" };
            this.baseUnit = "c";

            this.fomular = new object();
            this.fomular["c->c"] = "c";
            this.fomular["c->f"] = "c*9/5+32";
            this.fomular["f->c"] = "(f*5-160)/9";
            this.fomular["c->k"] = "c+273.15";
            this.fomular["k->c"] = "k-273.15";
        }
    }
}
